package com.lbm.business.service.impl;

import java.util.List;
import com.lbm.baseclass.exception.ServiceException;
import com.lbm.baseclass.service.impl.BaseServiceImpl;
import com.lbm.business.service.IRoleInfoService;
import com.lbm.model.RoleInfo;

public class RoleInfoServiceImpl  extends BaseServiceImpl implements IRoleInfoService{
	/**
	 * 通过HQL构造查询条件来查询符合条件的Userinfo信息
	 * 
	 * @param hql
	 * @return List
	 * @throws DataAccessException
	 */
	@Override
	public List getRoleInfoByHQL(String hql) throws ServiceException {
		return baseDAO.getValueObjectsByHQL(hql);
	}
	/**
	 * 根据主键查询Userinfo信息明细
	 * 
	 * @param id
	 * @throws DataAccessException
	 */
	@Override
	public RoleInfo getRoleInfoById(String id) throws ServiceException {
		RoleInfo roleinfo=null;
		List list=baseDAO.getValueObjectsByHQL(" from RoleInfo where roleid='"+id+"'");
		if(!list.isEmpty()&&list.size()>0){
			roleinfo=(RoleInfo)list.get(0);
		}
		return roleinfo;
	}
	/**
	 * 查询所有的Userinfo信息
	 * 
	 * @param hql
	 * @return List
	 * @throws DataAccessException
	 */
	@Override
	public List getAllRoleInfo() throws ServiceException {
		return baseDAO.getValueObjectsByHQL(" from RoleInfo");
	}
	/**
	 * 新增、修改Userinfo信息
	 * 
	 * @param Userinfo
	 * @throws DataAccessException
	 */
	@Override
	public void saveOrUpdateRoleInfo(RoleInfo roleinfo) throws ServiceException {
		baseDAO.saveOrUpdateVO(roleinfo);
	}
	/**
	 * 删除Userinfo信息
	 * 
	 * @param id
	 * @throws DataAccessException
	 */
	@Override
	public void deleteRoleInfo(String id) throws ServiceException {
		RoleInfo userinfo=this.getRoleInfoById(id);
		baseDAO.deleteVO(userinfo);
	}
}
